package com.wnxy.sddfp.client.bank;

import com.wnxy.sddfp.client.bank.callback.TradeLogApiCallback;
import com.wnxy.sddfp.common.enums.BorrowRecordStatusDTO;
import com.wnxy.sddfp.common.model.dto.bank.BankCardAddDTO;
import com.wnxy.sddfp.common.model.dto.bank.SignatureDTO;
import com.wnxy.sddfp.common.model.dto.bid.BankBidDTO;
import com.wnxy.sddfp.common.model.dto.bid.BidBalanceDTO;
import com.wnxy.sddfp.common.model.vo.bid.LoanVo;
import com.wnxy.sddfp.common.model.vo.trade.BorrowRecordVo;
import com.wnxy.sddfp.common.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @FeignClient
 * 1、指定当前接口是一个feign接口，value指定当前接口对应的服务提供者服务名称
 * 2、value与服务提供者中配置的spring.application.name名称一致
 */
@FeignClient(value = "sddfp-bank-access-service",fallback = TradeLogApiCallback.class)
public interface TradeLogApi {
    /**
     * 服务提供者对外暴漏的接口，供OpenFeign远程调用使用
     * 注意：接口的路径、返回、接口名称、参数必须与提供者保持一致（提供者controller方法）
     */
    @ApiOperation("绑卡生成交易记录")
    @PostMapping("/bank/access/card")
    Result proxyBindCardLog(@RequestBody BankCardAddDTO bankCardAddDTO);

    /**
     * 借款审核，同步借款数据
     */
    @ApiOperation("借款审核，同步借款数据")
    @PostMapping("/bank/access/sync/borrow")
    Result syncBorrowRecord(@RequestBody BorrowRecordVo borrowRecordVo);

    @ApiOperation("获取机构账户余额")
    @PostMapping("/bank/access/bid/balance/{userCode}")
    Result<BidBalanceDTO> getBidBalance(@PathVariable("userCode") String userCode);

    @ApiOperation("机构投资申购数据")
    @PostMapping("/bank/access/bid/add")
    Result addBankBidAgency(@RequestBody BankBidDTO bankBidDTO);

    @ApiOperation("放款确认")
    @PostMapping("/bank/access/confirm-loan")
    Result confirmLoan(@RequestBody LoanVo loanVo);

    @ApiOperation("同步借款状态")
    @PostMapping("/bank/access/borrowRecord/status")
    Result<String> updateBorrowRecordStatus(@RequestBody BorrowRecordStatusDTO brsDTO);
}